import request from '@/utils/request';
import { getPageSize } from '@/utils/common';

/**
 * 查询报关列表
 */
export async function selectDeclareList(params) {
  params.pageSize = params.pageSize || 20;
  return request(`/server/api/mds/mds-road-manifest/selectMdsRoadManifestList`, {
    method: 'POST',
    body: params,
  });
}

/**
 * 查询报关详情
 */
export async function selectDeclareDetail(params) {
  return request(`/server/api/mds/mds-road-manifest/viewMdsRoadManifestDetails`, {
    method: 'POST',
    body: params,
  });
}
//保存操作 0:暂存、1:暂存并申报
export async function saveDeclare(params) {
  const { flag, ...body } = params;
  const url = flag == 1 ? 'holdAndApplyMdsRoadManifest' : 'holdMdsRoadManifest';
  return request(`/server/api/mds/mds-road-manifest/${url}`, {
    method: 'POST',
    body,
  });
}

/**
 * 查询报关明细--提运单信息
 */
export async function selectDeliveryList(params) {
  return request(`/server/api/mds/mds-delivery/selectMdsDeliveryList`, {
    method: 'POST',
    body: params,
  });
}

/**
 * 查询 报关明细--提运单信息 详情
 */
export async function detailsDelivery(params) {
  return request(`/server/api/mds/mds-delivery/viewMdsDeliveryDetails`, {
    method: 'POST',
    body: params,
  });
}

/**
 * 查询报关明细--商品项信息
 */
export async function selectGoodsList(params) {
  return request(`/server/api/mds/mds-goods/selectMdsGoodsList`, {
    method: 'POST',
    body: params,
  });
}

//查询：集装箱列表
export async function selectContainerList(params) {
  return request(`/server/api/mds/mds-container/selectMdsContainerList`, {
    method: 'POST',
    body: params,
  });
}
//舱单-->提运单-->查询集装箱集合
export async function selectContainerByIdsList(params) {
  return request(`/server/api/mds/mds-container/selectMdsContainerListByIds`, {
    method: 'POST',
    body: params,
  });
}
//舱单-->提运单-->查询货重总量
export async function getMdsDeliveryInfo(params) {
  return request(`/server/api/mds/mds-delivery/getMdsDeliveryInfo`, {
    method: 'POST',
    body: params,
  });
}

/**
 * 查询附件
 */
export async function selectFileList(params) {
  return request(`/server/api/tms/attachment/selectFileList`, {
    method: 'POST',
    body: params,
  });
}
//查询IC卡：
export async function selectIcCardList(params) {
  return request(`/server/api/mds/mds-ic-card/selectMdsIcCardList`, {
    method: 'POST',
    body: params,
  });
}

//2.1 预配舱单列表--POST /mds-road-manifest/selectMdsRoadManifestListByPreplan
export async function selectManifestPlusList(params) {
  return request(`/server/api/mds/mds-road-manifest/selectMdsRoadManifestListByPreplan`, {
    method: 'POST',
    body: params,
  });
}
//2.2 预配舱单列表详情--POST /mds-road-manifest/viewMdsRoadManifestDetailsByPreplan
export async function selectManifestPlusDetail(params) {
  return request(`/server/api/mds/mds-road-manifest/viewMdsRoadManifestDetailsByPreplan`, {
    method: 'POST',
    body: params,
  });
}
//2.3 预备舱单：提运单列表 
export async function mdsDeliveryList(params) {
  return request(`/server/api/mds/mds-delivery/selectMdsDeliveryListByPreplan`, {
    method: 'POST',
    body: params,
  });
}
/**
 *2.4 预配舱单--提运单信息 详情
 */
export async function mdsDelivery(params) {
  return request(`/server/api/mds/mds-delivery/viewMdsDeliveryDetailsByPreplan`, {
    method: 'POST',
    body: params,
  });
}
//2.5预配舱单--提交 POST /mds-road-manifest/holdMdsRoadManifestByPreplan
export async function mdsSave(params) {
  return request(`/server/api/mds/mds-road-manifest/holdMdsRoadManifestByPreplan`, {
    method: 'POST',
    body: params,
  });
}